package com.business_clean.ui.adapter.classes;

import android.view.View;

import com.business_clean.R;
import com.business_clean.data.mode.classes.ClassesListEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

public class ClassesManageAdapter extends BaseQuickAdapter<ClassesListEntity, BaseViewHolder> {

    private boolean isSelected = false;

    public ClassesManageAdapter(boolean isSelected) {
        super(R.layout.item_classes_manager);
        this.isSelected = isSelected;
        addChildClickViewIds(R.id.iv_item_classes_edit, R.id.iv_item_classes_del);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, ClassesListEntity item) {
        holder.setText(R.id.tv_item_classes_title, item.getClass_name())
                .setText(R.id.tv_item_classes_date, item.getClass_time());

        holder.getView(R.id.iv_item_classes_edit).setVisibility(isSelected ? View.GONE : View.VISIBLE);
        holder.getView(R.id.iv_item_classes_del).setVisibility(isSelected ? View.GONE : View.VISIBLE);
    }

}